package com.xiaobaibai.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.xiaobaibai.valid.AddGroup;
import com.xiaobaibai.valid.ListValue;
import com.xiaobaibai.valid.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 
 * </p>
 *
 * @author xiaobaibai
 * @since 2020-10-16
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("index_detail")
@ApiModel(value="IndexDetail对象", description="")
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public class IndexDetail implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "首页大图宫格id")
    @TableId(value = "id", type = IdType.AUTO)
    @Null(message = "新增不可指定id",groups = AddGroup.class)
    @NotNull(message = "修改需指定id",groups = UpdateGroup.class)
    private Integer id;

    @ApiModelProperty(value = "名称")
    @TableField("name")
    @NotNull(message = "名称不可为空",groups = {AddGroup.class})
    private String name;

    @ApiModelProperty(value = "图片")
    @TableField("image")
    @NotNull(message = "图片不可为空",groups = {AddGroup.class})
    private String image;

    @ApiModelProperty(value = "排序")
    @TableField("sort")
    private Integer sort;

    @ApiModelProperty(value = "状态:0不显示1显示;(废弃)")
    @TableField("status")
    private Boolean status;

    @ApiModelProperty(value = "类型:0轮播图1:宫格2:推广图")
    @TableField("type")
    @NotNull(message = "类型不可为空",groups = {AddGroup.class})
    @ListValue(values = {0,1,2})
    private Integer type;

    @ApiModelProperty(value = "跳转地址")
    @TableField("url")
    @NotNull(message = "跳转地址不可为空",groups = {AddGroup.class})
    private String url;

    @ApiModelProperty(value = "创建时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private Date createTime;

    @ApiModelProperty(value = "修改时间")
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;


}
